
#define ACTIVE 0
#define IDLE 1

volatile unsigned char pulseCount = 34;
volatile unsigned char state = IDLE;

volatile unsigned long activeStart = 0;
volatile unsigned long idleStart = 0;


void setup()
{
  Serial.begin(115200);                         // Initialize Serial Port
  Serial.println("Starting...");              // Print Message To Indicate Program Is Starting  
  attachInterrupt(0, changeEventISR, CHANGE);   // Create An Change Triggered External Interrupt On Pin 2.
}

void loop()
{
  
}

void changeEventISR()
{
  //Start Of New Pulse
  if(pulseCount == 34)
  {
    if(state = IDLE)
    {
       //First Active Edge
       state = IDLE; 
    }
  }
  //Mid Command Pulse
  else
  {
    
  }
  
}
